﻿package mortal.game.view.guild.cellrender
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;

    public class GuildBuildingNameListCellRenderer extends GuildCellRenderer
    {
        private var _buildingName:GTextFiled;
        private var _curLv:GTextFiled;
        private var _nextLvCondition:GTextFiled;

        public function GuildBuildingNameListCellRenderer()
        {
            this.setStyle("selectedUpSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedDownSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            this.setStyle("selectedOverSkin", ResourceConst.getScaleBitmap(ImagesConst.taskItemSelected));
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = TextFormatAlign.JUSTIFY;
            this._buildingName = UIFactory.textField("" + Language.getString(71085), 5, 0, 60, 20, this, _loc_1);
            var _loc_2:* = GlobalStyle.textFormatLv;
            _loc_2.align = TextFormatAlign.CENTER;
            this._curLv = UIFactory.textField("10" + Language.getString(71084), 75, 0, 60, 20, this, _loc_2);
            this._nextLvCondition = UIFactory.textField("", 145, 0, 62, 20, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._buildingName.dispose(param1);
            this._curLv.dispose(param1);
            this._nextLvCondition.dispose(param1);
            this._buildingName = null;
            this._curLv = null;
            this._nextLvCondition = null;
            return;
        }// end function

        override public function get data() : Object
        {
            return super.data;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_3:int = 0;
            super.data = param1;
            var _loc_2:* = param1 as TGuildStructureConfig;
            if (_loc_2)
            {
                this._buildingName.text = GuildConst.getBuildingNameByType(_loc_2.structureType);
                this._curLv.text = _loc_2.structureLevel + "" + Language.getString(71084);
                _loc_3 = GuildBuildingConfig.instance.getNextBuildingLvNeedGuildLv(Cache.instance.guild.selfGuildInfo.baseInfo.level, _loc_2.structureType);
                if (_loc_3 == -1)
                {
                    this._nextLvCondition.text = "" + Language.getString(71086);
                }
                else
                {
                    this._nextLvCondition.text = Language.getStringByParam(71087, _loc_3);
                }
            }
            return;
        }// end function

    }
}
